/*
 * @Author: huangyingli
 * @Date: 2023-02-23 22:54:45
 * @LastEditors: huangyingli
 * @LastEditTime: 2023-02-24 00:32:30
 * @Description:
 */
/*
 * @Author: huangyingli
 * @Date: 2023-02-23 22:54:45
 * @LastEditors: huangyingli
 * @LastEditTime: 2023-02-23 22:56:28
 * @Description:
 */
import { Button, Table } from 'antd';
import { useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { columnList } from '../../api/columnManage';

export default function ColumnManage() {
  const navigate = useNavigate();
  const [list, setList] = useState([]);
  function onClick() {
    navigate('/column-manage-handle');
  }
  useEffect(() => {
    columnList().then(({ data }) => {
      setList(data.data);
    });
  }, []);
  const columns = [
    {
      title: '栏目名称',
      key: 'name',
      dataIndex: 'name',
    },
    {
      title: '所属模板',
      key: 'modalId',
      dataIndex: 'modalId',
    },
    {
      title: '栏目路由',
      key: 'route',
      dataIndex: 'route',
    },
    {
      title: '显示/隐藏',
      key: 'isShow',
      dataIndex: 'isShow',
    },
    {
      title: '热门栏目',
      key: 'isHot',
      dataIndex: 'isHot',
    },
  ];
  return (
    <>
      <Button type='primary' onClick={onClick}>
        新增栏目
      </Button>

      <br></br>

      <br></br>

      <Table columns={columns} dataSource={list}></Table>
    </>
  );
}
